#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int n;
    cin >> n;

    ll A = 0, C = 0, B = 0, X = 0, Y = 0, Z = 0;

    for (int i = 0; i < n; i++) {
        ll a, b, c;
        cin >> a >> b >> c;

        A += a;
        C += c;
        B += b;
        X += min(a, b);
        Y += min(c, b);
        if (b > c) {
            Z += min(a, b - c);
        }

        ll c1 = A;
        ll c2 = C;
        ll c3 = B / 2;
        ll c4 = X;
        ll c5 = Y;
        ll c6 = (Y + Z) / 2;

        ll ans = min({c1, c2, c3, c4, c5, c6});
        cout << ans << '\n';
    }
    return 0;
}